#!/usr/bin/env python
# -*- coding:utf-8 -*-

# file:do_exam1.py
# author:王雯雯
# datetime:2024-11-12 
# software: PyCharm

import hashlib

def encrypt_password(password):
    hash_object = hashlib.sha256(password.encode())
    return hash_object.hexdigest()

students = []
for _ in range(5):
    name = input("请输入同学姓名: ")
    account = input("请输入账号: ")
    password = input("请输入密码: ")
    encrypted_password = encrypt_password(password)
    students.append((name, account, encrypted_password))

with open("D:\students.txt", "w") as f:
    for student in students:
        f.write(f"{student[0]} {student[1]} {student[2]}\n")
